package com.example.workshop.lesson9;

import com.example.workshop.lesson9.Filter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ContentBasedFilter implements Filter {
    private static int instances=0;
    @Autowired
    private Movie movie;
    public ContentBasedFilter(Movie movie) {
        super();
        this.movie=movie;
        instances++;
        System.out.println("ContentBasedFilter constructor called");
    }

    public Movie getMovie() {
        return movie;
    }

    public static int getInstances() {
        return ContentBasedFilter.instances;
    }
    //输入推荐电影
    public String[] getRecommendations(String movie) {
       //电影之间的相似度
        // 返回电影推荐
       return new String[] {"火星救援","星球大战","星际穿越"};
    }
}
